/*
Copyright (c) 2009, Young Digital Planet SA
All rights reserved.

* Redistribution and use in source and binary forms, with or without 
  modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this 
  list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, 
  this list of conditions and the following disclaimer in the documentation 
  and/or other materials provided with the distribution.
* Neither the name of the Young Digital Planet SA nor the names of its 
  contributors may be used to endorse or promote products derived from this 
  software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGE.
*/
package com.yauthor.module.test
{
	import com.yauthor.module.IHintsInfo;
	import com.yauthor.module.Result;
	
	import flash.events.IEventDispatcher;
	import com.yauthor.module.time.ITimeControllerSocket;
	
	 /**
	 * Dispatched when the simple test controler properties has changed. 
	 * Contains details for result & status changes 
	 * @eventType com.yauthor.module.events.AttributeChangeEvent.ATTRIBUTE_CHANGE
	 */
	[Event(name="attributeChange",type="com.yauthor.module.events.AttributeChangeEvent")]
	
	/**
	 * Utopia test controler. Allows some simple test navigation and provides  
	 * basic info about state of the currently edited lesson. 
	 * ITestControler object can be accesed from module context. 
	 * @see com.yauthor.module.IModuleContext
	 */
	public interface ISimpleTestControler extends IEventDispatcher{
		
		
		/**
		 * Indicates whether unit controller started.
		 */
		function get isStarted():Boolean;
		
		/**
		 * Returns test result info
		 */
		function get result():Result;
		
		/**
		 * Returns mistakes count
		 */
		function get mistakes():uint;
		
		/**
		 * Returns hints count
		 */
		function get hints():uint;
		
		/**
		 * Unit progress status.
		 * Status identifiers are available via TestStatusConts class. 
		 * @see com.yauthor.module.test.TestStatusConts
		 */
		function get unitStatus():String;
			
			
		/**
		 * Time spent in unit.
		 */
		function get totalTime():Number;
		
		/**
		 * Returns results of currently dislpayed page 
		 */
		function get currentItemResult():Result;
		
		/**
		 * Returns hints of currently dislpayed page 
		 */
		function get currentItemHints():IHintsInfo;
		
		/**
		 * Returns index of currently displayed page 
		 */
		function get currentIndex():int;
		
		/**
		 * Checks if navigation to specified direction is available.
		 * @param direction
		 * <ul>
		 * 	<li>"next" - next element
		 * 	<li>"prev", "previous" - previous element
		 *  <li>"first" - first element
		 *  <li>"last" - last element
		 *  <li>Number - switch to element index 
		 *  <li>"#itemId" - switch to element element index 
		 * </ul>
		 * @return true is returned if navigation to specified element is possible
		 */
		function isNavigationAvailable( direction:* ):Boolean;
		
		
		/**
		 * Method allows to switch test in a specified direction  
		 * @param direction direction identifier
		 * @return returns true if switch was successful
		 * @see #isNavigationAvailable
		 */
		function navigate( direction:* ):Boolean;
		
		
		/**
		 * Method returns test length
		 * @return number of test items
		 */ 
		function get itemsCount():uint;
		
		
		/**
		 * Method gives access to basic informations about specifed test item
		 * @param test item index
		 * @return instance of 'ISimpleTestItemInfo'
		 * @see com.yauthor.module.test.ISimpleTestItemInfo
		 */
		function getItemInfo( index:uint ):ISimpleTestItemInfo;
		
		/**
		 * Method resolves absolute path from a relative path  
		 * @param path path to be resolved ( relative to the player base path ) 
		 * @return absolute path
		 */
		function resolveAbsolutePath( path:String ):String;
		
		/**
		 * Locks or unlocks test view
		 */ 
		function set locked(bool:Boolean):void
		
		/**
		 * Returns <code>true</code> if test view is locked, <false> otherwise
		 */ 
		function get locked():Boolean	
	}
	
	
	
}